//
//  HDJDWorkDetailCell.m
//  HubeiHotel
//
//  Created by 张露杰 on 18/3/14.
//  Copyright © 2018年 张露杰. All rights reserved.
//

#import "HDJDWorkDetailCell.h"

@implementation HDJDWorkDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    //    继承父类
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
    }
    return self;
}

-(void)loadCellWithData:(NSDictionary *)data
{
    //    重新布局
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
    
    NSArray *keys = [data[@"keyword"] componentsSeparatedByString:@","];
    
    UIView *lastView;
    for (int i = 0; i < keys.count; i++) {
        UILabel *label;
        if (i == 0) {
            label = [TomamaUI createLabel:CGRectMake(25*screenW_6, 17*screenW_6, [TomamaUI getStringWeithtWith:keys[i] andHeigth:23*screenW_6 andFont:[UIFont systemFontOfSize:11*screenW_6]] + 16*screenW_6, 23*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:11*screenW_6] textColor:[UIColor colorWithHexString:@"#7bcdca"] text:keys[i]];
        }else{
            label = [TomamaUI createLabel:CGRectMake(CGRectGetMaxX(lastView.frame) + 10*screenW_6, 17*screenW_6, [TomamaUI getStringWeithtWith:keys[i] andHeigth:23*screenW_6 andFont:[UIFont systemFontOfSize:11*screenW_6]] + 16*screenW_6, 23*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:11*screenW_6] textColor:[UIColor colorWithHexString:@"#7bcdca"] text:keys[i]];
        }
        label.layer.masksToBounds = YES;
        label.layer.borderColor = [UIColor colorWithHexString:@"#7bcdca"].CGColor;
        label.layer.borderWidth = 1;
        label.layer.cornerRadius = 10*screenW_6;
        lastView = label;
        [self.contentView addSubview:label];
    }

    UILabel *detailLabel = [TomamaUI createLabel:CGRectMake(25*screenW_6, CGRectGetMaxY(lastView.frame) + 18*screenW_6, SCREENW - 50*screenW_6, 14) textAligment:0 font:[UIFont systemFontOfSize:14*screenW_6] textColor:[UIColor colorWithHexString:@"#666666"] text:@"岗位职责:"];
    [self.contentView addSubview:detailLabel];
}

@end
